import java.util.Scanner;

public class 求阶乘之和 {
        public static void main(String[] args){
            Scanner scanner=new Scanner(System.in);
            System.out.println("请输入整数n：");
            int n=scanner.nextInt();
            System.out.println(getFactorial(n));
        }
        public static  int getFactorial(int n) {
            int sum = 1;
            if (n < 0) {
                System.out.println("负数没有阶乘！");
            }else if(n==0||n==1){
                System.out.println(n+"的阶乘为1");}
            else{
                for(int i=1;i<=n;i++){
                    sum*=i;
                }
                return  sum;
            }
            return  sum;

        }


    }
